const values_default = {}

const domain_default = {}

const fields_default = {
  can_be_expensed: null,
  name: null,
  type: null,
  list_price: null,
  standard_price: null,
  uom_id: null,
  uom_po_id: null,
  default_code: null,
  company_id: null,
  property_account_expense_id: null,
  supplier_taxes_id: null,
  taxes_id: null
  //  pricelist_item_ids: { name: null }
}

const filterItems = [
  { type: 'input', name: 'name___like', placeholder: '名称' }
]

const columns = [
  { name: 'can_be_expensed', type: 'boolean', label: '可报销' },
  { name: 'name', type: 'char', label: '名称' },
  { name: 'type__name', type: 'char', label: '类型' },
  { name: 'list_price', type: 'char', label: '价格' },
  { name: 'standard_price', type: 'char', label: '成本' },
  { name: 'default_code', type: 'char', label: '编码' },
  { name: 'company_id__name', type: 'char', label: '公司' }
  // { name: 'pricelist_item_ids_names', type: 'char', label: '产品' }
]

const formItems = [
  { type: 'input', name: 'name', label: '名称' },
  {
    type: 'input',
    name: 'default_code',
    label: '编码',
    rules: { required: false }
  },
  { type: 'select2', name: 'type', label: '类型', defalut: 'service' },
  { type: 'input', name: 'list_price', label: '价格', defalut: 'service' },
  { type: 'input', name: 'standard_price', label: '成本', defalut: 'service' },
  {
    type: 'select',
    name: 'company_id',
    label: '公司',
    rules: { required: false },
    placeholder: '公司'
  }
]

const child_configs = {}

const Model = {
  // name: 'res.partner',
  configs: {
    values_default,
    domain_default,
    fields_default,
    filterItems,
    columns,
    formItems,
    child_configs
  },

  extend: BaseClass => {
    class ModelClass extends BaseClass {
      global_domain(domain_src = {}) {
        // console.log('this.global_domain in odoo.res.partner')
        const domain = { ...domain_src }
        // const userinfo = self.get_userinfo()
        // const { uid } = userinfo
        // domain.user_id = uid
        return super.global_domain(domain)
      }
    }
    return ModelClass
  }
}

export default Model
